package com.movitech.mobile.cz.base.supplier.service.impl;

import com.movitech.mobile.cz.base.common.util.CommonConstants;
import com.movitech.mobile.cz.base.common.util.IdGenUtils;
import com.movitech.mobile.cz.base.common.util.StringUtils;
import com.movitech.mobile.cz.base.supplier.entity.SSuppliersInspectionScore;
import com.movitech.mobile.cz.base.supplier.mapper.SSuppliersInspectionScoreMapper;
import com.movitech.mobile.cz.base.supplier.service.SSuppliersInspectionScoreService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.Date;

import com.movitech.mobile.cz.base.util.UserUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 供方考察报告-打分明细 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-02-28
 */
@Service("sSuppliersInspectionScoreService")
@Transactional
public class SSuppliersInspectionScoreServiceImpl extends ServiceImpl<SSuppliersInspectionScoreMapper, SSuppliersInspectionScore> implements SSuppliersInspectionScoreService {

	@Override
	public boolean addSSuppliersInspectionScore(SSuppliersInspectionScore sSuppliersInspectionScore) {
		
		if(StringUtils.isNotEmpty(sSuppliersInspectionScore.getId())){
			sSuppliersInspectionScore.setId(IdGenUtils.uuid());
		}
		
		Date createDate = new Date();
		String userId = UserUtils.getCurrentUserId();
		sSuppliersInspectionScore.setCreateBy(userId);
		sSuppliersInspectionScore.setCreateDate(createDate);
		sSuppliersInspectionScore.setUpdateBy(userId);
		sSuppliersInspectionScore.setUpdateDate(createDate);
		sSuppliersInspectionScore.setDelFlag(CommonConstants.NO_INTEGER);
		
		int i = baseMapper.insert(sSuppliersInspectionScore);
		
		return i > 0;
	}

}
